<%- if resource_administrated?(relationship_class) && relationship_class.respond_to?(:autocomplete_attribute) && relationship_class.autocomplete_attribute.present? -%>
  <%= form_tag relate_to_url(object), :class => 'relate-to-form', :method => :put do %>
    <fieldset class="inputs">
      <h4>Add a <%= relationship_class.model_name.human %></h4>
      <%= hidden_field_tag 'relationship_name', relationship %>
      <ol>
        <li class="label">
          <label for="related_id">
            <%= relationship_class.model_name.human %>
            <%= relationship_class.human_attribute_name(relationship_class.autocomplete_attribute) %>
          </label>
        </li>
        <li class="input">
          <%= hidden_field_tag 'related_id', nil, :class => 'token-input',
            'data-model-name' => relationship_class.model_name.singular %>
        </li>
        <li class="button"><%= submit_tag "Add #{relationship_class.model_name.human}" %></li>
      </ol>
    </fieldset>
  <% end %>
<%- end -%>
